package com.eric.windows.viewAnimation;

import android.os.Bundle;
import android.app.Activity;
import android.view.View;
import android.widget.ImageView;
import android.widget.ViewFlipper;

import com.eric.windows.R;

public class ViewFlipperActivity extends Activity  {
    private ImageView img1;
    private ImageView img2;
    private ImageView img3;
    private ViewFlipper flipper;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_view_flipper);

        flipper = (ViewFlipper) findViewById(R.id.view_flipper);
        img1 = (ImageView) findViewById(R.id.img1);
        img2 = (ImageView) findViewById(R.id.img2);
        img3 = (ImageView) findViewById(R.id.img3);

    }
    public void next(View view){
        flipper.setInAnimation(this,R.anim.left_enter);
        flipper.setOutAnimation(this,R.anim.left_exit);
        flipper.showNext();
        flipper.stopFlipping();
    }
    public void previous(View view){
        flipper.setInAnimation(this,R.anim.right_enter);
        flipper.setOutAnimation(this,R.anim.right_exit);
        flipper.showPrevious();
        flipper.stopFlipping();
    }
    public void auto(View view){
        flipper.startFlipping();
    }

}
